package com.lefu.es.db2;

import com.lefu.es.application.IwellnessApplication;
import com.lefu.es.entity.DeviceMacDao;

import java.util.List;

/**
 * oAuthor:${李强}
 * date:2018/4/23
 * time:19:25
 * projectName:iWellnessCN2_en_new 3.0_1
 */

public class MacDao {
    /**
     * 添加数据，如果有重复则覆盖
     *
     * @param deviceMacDao
     */
    public static void insertMac(DeviceMacDao deviceMacDao) {
        IwellnessApplication.getDaoInstant().getDeviceMacDaoDao().insertOrReplace(deviceMacDao);
    }

    /**
     * 删除数据
     *
     * @param id
     */
    public static void deleteMac(long id) {
        IwellnessApplication.getDaoInstant().getDeviceMacDaoDao().deleteByKey(id);
    }

    /**
     * 更新数据
     *
     * @param deviceMacDao
     */
    public static void updateMac(DeviceMacDao deviceMacDao) {
        IwellnessApplication.getDaoInstant().getDeviceMacDaoDao().update(deviceMacDao);
    }

    /**
     * 查询全部数据
     */
    public static List<DeviceMacDao> queryAll() {
        return IwellnessApplication.getDaoInstant().getDeviceMacDaoDao().loadAll();
    }

}
